package day14.com.zhiyou100;

import java.util.ArrayList;
import java.util.List;

public class Demo02 {
    public static void main(String[] args) {
        List<String> list = new ArrayList<>();
        list.add("aa");
        list.add("bb");
        list.add("cc");
        list.add("aa");
        list.add("ee");
        list.add("aa");
        // 第一次和最后一次出现的位置
        int index01 = list.indexOf("aa");
        System.out.println(index01);// 0
        int lastIndexOf = list.lastIndexOf("aa");
        System.out.println(lastIndexOf);// 5
        List<String> subList = list.subList(0, 4);// [0,3]
        System.out.println(subList);//


    }
}
